using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_RXListMap : EntityTypeConfiguration<SO_RXList>
    {
        public SO_RXListMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Brand_Name, t.Generic_Name, t.Category });

            // Properties
            this.Property(t => t.ID)
                .HasMaxLength(10);

            this.Property(t => t.Brand_Name)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.Generic_Name)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.Category)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Dose)
                .HasMaxLength(20);

            this.Property(t => t.Form)
                .HasMaxLength(20);

            this.Property(t => t.Usage)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("SO_RXList");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Brand_Name).HasColumnName("Brand_Name");
            this.Property(t => t.Generic_Name).HasColumnName("Generic_Name");
            this.Property(t => t.Category).HasColumnName("Category");
            this.Property(t => t.Dose).HasColumnName("Dose");
            this.Property(t => t.Form).HasColumnName("Form");
            this.Property(t => t.Usage).HasColumnName("Usage");
        }
    }
}
